<% total_geral = 0%>
<% @depositos.each do |d| %>    
  <div class='deposito_<%= d.nome.downcase_br %>'>
    <div class='title_<%= d.nome.downcase_br %>'>
      <%=h d.nome.upcase_br %>
    </div>
    <table cellpadding="1" cellspacing="0" >
    
      <th><strong>DEPOSITO</strong></th>
      <th><strong>BOX</strong></th>
      <th><strong>Nº.DT</strong></th>
      <th><strong>TRANSP.</strong></th>
      <th><strong>UF</strong></th>
      <th><strong>PARES</strong></th>
      <th><strong>CXS</strong></th>
      <th><strong>TIPO</strong></th>
      <th><strong>VOLUME</strong></th>
      <th><strong>PESO</strong></th>
      <th><strong>STATUS</strong></th>
      <th><strong>HORA</strong></th>
      <th><strong>ETQ</strong></th>
      <th><strong>CARRO</strong></th>
    
                <% @transportes.each do |wm| %>    
                                              <% if wm.deposito.id == d.id %>
          <tr class="<%= cycle("even", "odd") -%>">
            <td><%= wm.deposito.nome%></td>
            <td><%=wm.box%></td>
            <td><%=wm.ndt.para_dinheiro.to_s_m%></td>
            <td><%=wm.transportadora.nome%></td>
            <td><%=wm.uf.sigla%></td>
            <td><%=wm.pares.para_dinheiro.to_s_m%></td>
            <td><%=wm.cxs.para_dinheiro.to_s_m%></td>
            <td><%=wm.tipo.sigla%></td>
            <td><%=wm.m.para_dinheiro.to_s_m%></td>
            <td><%=wm.peso.para_dinheiro.to_s_m%></td>
            <td><%=wm.status.sigla%></td>
            <td><%=wm.created_at.hour.to_s + ":" + wm.created_at.min.to_s + ":" + wm.created_at.sec.to_s%></td>
            <td><%=wm.etq%></td>
            <td><%=wm.obs_trans%></td>
          </tr>
        <%end%>
    <%end%>
  
      <tr id="aaaaaa" class="aaaaaa">
        <td class="aaaaaa"></td>
        <td class="aaaaaa"></td>
        <td class="aaaaaa"></td>
        <td class="aaaaaa"></td>
        <td class="aaaaaa"></td>
        <td class="aaaaaa">
          <% soma_pares = 0%>
          <% @status.each do |s|
                      soma_pares += d.soma_s_d(s,d.id).to_i
          end %>
          <%total_geral += soma_pares%>
          Total: <%= soma_pares.para_dinheiro.to_s_m%>
        </td>
        <td class="aaaaaa"></td>
        <td class="aaaaaa"></td>
        <td class="aaaaaa"></td>
        <td class="aaaaaa"></td>
        <td class="aaaaaa"></td>
        <td class="aaaaaa"></td>
        <td class="aaaaaa"></td>
        <td class="aaaaaa"></td>
      </tr>
    </table>
  
  <%end%>
  <div id='soma_total_deposito'>
    <label class='total'>Total:</label>
    <label class='valor'><%= total_geral.to_i.para_dinheiro.to_s_m %></label>
  </div>
</div> 